In [7]:
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.colors as mcolors
import matplotlib.ticker as mticker
import mpl_toolkits
from mpl_toolkits.basemap import Basemap
import re
import os
from IPython.display import display, HTML
import warnings
from classifier import Classifier
from constants import *
warnings.simplefilter(action='ignore', category=FutureWarning)
pd.set_option('display.max_rows', 300000)
pd.set_option('display.max_columns', 500)
In [8]:
csvs = sorted(os.listdir(INPUTS_PATH))
csvs
Out[8]:
['2014-final.xlsx - Sheet1.csv', '2015-final.xlsx - Sheet1.csv', '2016-final.xlsx - Total counts.csv', '2017-final.xlsx - 2017 LIS phytoplankton count.csv', '2018-Final Report Data.xlsx - 2018 LIS phytoplankton count.csv', 'LIS_2019-Phytoplankton_Final Report Data.xlsx - 2019 LIS phytoplankton count.csv', 'LIS_2020-Phytoplankton_Final Report Data.xlsx - 2020 LIS phytoplankton count.csv', 'LIS_2021-Phytoplankton_Final Report Data.xlsx - 2021 LIS phytoplankton count.csv']
In [9]:
season2month = {
'Winter': ['January', 'February', 'March'],
'Spring': ['April', 'May', 'June'],
'Summer': ['July', 'August', 'September'],
'Fall': ['October', 'November', 'December']
}
season2boundary = {
'Winter': (0, 1750000),
'Spring': (0, 2250000),
'Summer': (0, 3000000),
'Fall': (0, 500000)
}
In [10]:
def sort_mixoplankton_type_by_season(season, csv_name):
months = season2month.get(season)
classified = Classifier(csv_name)
df = classified.add_multiheader(classified.mixoplankton)
df = pd.concat([df.loc[:, df.columns.get_level_values(2).isin(['MFT'])], df.loc[:, df.columns.get_level_values(0).isin(months)]], axis=1)
df = df.loc[~(df.loc[:, df.columns.get_level_values(0).isin(months)] == 0).all(axis=1)]
df.columns = df.columns.get_level_values(1)
df = pd.concat([df[[np.nan]], df.groupby(df.columns.str[0], axis=1).sum()], axis=1).rename(columns= {np.nan:'MFT'})
df = df.groupby('MFT').sum().reset_index()
df['Totals'] = df.iloc[:, 1:].sum(axis=1)
df['Percentages'] = ((df['Totals'] / df['Totals'].sum()) * 100)
return df
What different types of mixoplankton are found by station every year?¶
In [11]:
def display_tables_by_season(season):
for csv_name in csvs:
# Get year
year = re.search(r'\b(\d{4})\b', csv_name).group(1) if re.search(r'\b(\d{4})\b', csv_name) else 'Year not found'
# Get table for each year
display(HTML(f"<h2>Mixoplankton Functional Type in LIS in {season} of {year}</h2>"))
display(sort_mixoplankton_type_by_season(season, csv_name))
In [12]:
display_tables_by_season('Winter')
Mixoplankton Functional Type in LIS in Winter of 2014
| MFT | A | B | C | D | E | F | H | I | J | K | Totals | Percentages | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 0 | CM | 1636800 | 595452 | 638000 | 580800 | 110836 | 36652 | 155452 | 124036 | 140756 | 51260 | 4070044 | 100.0 |
Mixoplankton Functional Type in LIS in Winter of 2015
| MFT | A | B | C | D | E | F | H | I | J | K | Totals | Percentages | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 0 | CM | 409200 | 303600 | 208252 | 378400 | 343200 | 387200 | 354904 | 217008 | 243408 | 117304 | 2962476 | 100.0 |
Mixoplankton Functional Type in LIS in Winter of 2016
| MFT | A | B | C | D | E | F | H | I | J | K | Totals | Percentages | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 0 | CM | 77704 | 225852 | 215600 | 39556 | 24904 | 104104 | 200904 | 181852 | 52800 | 26400 | 1149676 | 100.0 |
Mixoplankton Functional Type in LIS in Winter of 2017
| MFT | A | B | C | D | E | F | H | I | J | K | Totals | Percentages | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 0 | CM | 167156 | 79156 | 70356 | 123156 | 43956 | 39600 | 33704 | 29304 | 38060 | 1452 | 625900 | 100.0 |
Mixoplankton Functional Type in LIS in Winter of 2018
| MFT | A | B | C | D | E | F | H | I | J | K | Totals | Percentages | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 0 | CM | 487564 | 324104 | 543312 | 406208 | 322608 | 205260 | 349756 | 146608 | 15312 | 112860 | 2913592 | 99.879333 |
| 1 | pSNCM | 704 | 704 | 0 | 1408 | 0 | 0 | 704 | 0 | 0 | 0 | 3520 | 0.120667 |
Mixoplankton Functional Type in LIS in Winter of 2019
| MFT | A | B | C | D | E | F | H | I | J | K | Totals | Percentages | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 0 | CM | 198308 | 217008 | 103004 | 305052 | 294008 | 220000 | 210408 | 168564 | 123332 | 66000 | 1905684 | 99.923865 |
| 1 | pSNCM | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1452 | 0 | 0 | 1452 | 0.076135 |
Mixoplankton Functional Type in LIS in Winter of 2020
| MFT | A | B | C | D | E | F | H | I | J | K | Totals | Percentages | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 0 | CM | 215600 | 683540 | 767052 | 349052 | 206008 | 142604 | 340560 | 60720 | 145288 | 63756 | 2974180 | 99.997041 |
| 1 | pSNCM | 0 | 88 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 88 | 0.002959 |
Mixoplankton Functional Type in LIS in Winter of 2021
| MFT | A | B | C | D | E | F | H | I | J | K | Totals | Percentages | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 0 | CM | 224400 | 127600 | 242000 | 212652 | 120252 | 178904 | 391600 | 200904 | 19008 | 168696 | 1886016 | 100.0 |
In [13]:
display_tables_by_season('Spring')
Mixoplankton Functional Type in LIS in Spring of 2014
| MFT | A | B | C | D | E | F | H | I | J | K | Totals | Percentages | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 0 | CM | 1739136 | 1999008 | 1506252 | 2230756 | 1865600 | 853512 | 2069018 | 1047156 | 1033956 | 852060 | 15196454 | 100.0 |
Mixoplankton Functional Type in LIS in Spring of 2015
| MFT | A | B | C | D | E | F | H | I | J | K | Totals | Percentages | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 0 | CM | 1296504 | 1856800 | 1140480 | 833052 | 805200 | 1918356 | 645304 | 569052 | 768504 | 475200 | 10308452 | 100.0 |
Mixoplankton Functional Type in LIS in Spring of 2016
| MFT | A | B | C | D | E | F | H | I | J | K | Totals | Percentages | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 0 | CM | 668800 | 595452 | 302104 | 881452 | 92356 | 231704 | 121704 | 274252 | 180356 | 85052 | 3433232 | 99.324075 |
| 1 | pSNCM | 0 | 10252 | 4400 | 1452 | 1452 | 0 | 2904 | 1452 | 1452 | 0 | 23364 | 0.675925 |
Mixoplankton Functional Type in LIS in Spring of 2017
| MFT | A | B | C | D | E | F | H | I | J | K | Totals | Percentages | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 0 | CM | 978252 | 539704 | 427548 | 698104 | 582252 | 305052 | 363704 | 145156 | 594000 | 119416 | 4753188 | 99.90844 |
| 1 | pSNCM | 0 | 1452 | 2904 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 4356 | 0.09156 |
Mixoplankton Functional Type in LIS in Spring of 2018
| MFT | A | B | C | D | E | F | H | I | J | K | Totals | Percentages | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 0 | CM | 1201200 | 1118304 | 1633852 | 486156 | 528000 | 638704 | 563200 | 775104 | 262504 | 181852 | 7388876 | 98.975641 |
| 1 | pSNCM | 0 | 704 | 2904 | 704 | 0 | 704 | 0 | 704 | 0 | 352 | 6072 | 0.081336 |
| 2 | pSNCM* | 0 | 0 | 0 | 70400 | 0 | 0 | 0 | 0 | 0 | 0 | 70400 | 0.943024 |
Mixoplankton Functional Type in LIS in Spring of 2019
| MFT | A | B | C | D | E | F | H | I | J | K | Totals | Percentages | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 0 | CM | 888800 | 690756 | 447304 | 682000 | 632104 | 378708 | 425304 | 689304 | 461956 | 189904 | 5486140 | 99.996792 |
| 1 | pSNCM | 0 | 0 | 176 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 176 | 0.003208 |
Mixoplankton Functional Type in LIS in Spring of 2020
| MFT | A | B | C | D | E | F | H | I | J | K | Totals | Percentages |
|---|
Mixoplankton Functional Type in LIS in Spring of 2021
| MFT | A | B | C | D | E | F | H | I | J | K | Totals | Percentages | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 0 | CM | 836088 | 1584176 | 729256 | 476652 | 497552 | 536800 | 718564 | 520608 | 375012 | 141152 | 6415860 | 99.998628 |
| 1 | pSNCM | 88 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 88 | 0.001372 |
In [14]:
display_tables_by_season('Summer')
Mixoplankton Functional Type in LIS in Summer of 2014
| MFT | A | B | C | D | E | F | H | I | J | K | Totals | Percentages | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 0 | CM | 1887556 | 1057408 | 690712 | 772904 | 551452 | 450208 | 494208 | 285956 | 488356 | 300476 | 6979236 | 99.791131 |
| 1 | pSNCM | 2904 | 4400 | 4400 | 0 | 0 | 2904 | 0 | 0 | 0 | 0 | 14608 | 0.208869 |
Mixoplankton Functional Type in LIS in Summer of 2015
| MFT | A | B | C | D | E | F | H | I | J | K | Totals | Percentages | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 0 | CM | 514800 | 1149412 | 968880 | 819720 | 499840 | 602800 | 378792 | 283800 | 83600 | 45408 | 5347052 | 99.754562 |
| 1 | pSNCM | 0 | 5852 | 5852 | 0 | 1452 | 0 | 0 | 0 | 0 | 0 | 13156 | 0.245438 |
Mixoplankton Functional Type in LIS in Summer of 2016
| MFT | A | B | C | D | E | F | H | I | J | K | Totals | Percentages | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 0 | CM | 639452 | 376904 | 708400 | 343156 | 107052 | 177452 | 189200 | 664356 | 0 | 86460 | 3292432 | 98.169844 |
| 1 | pSNCM | 11704 | 5808 | 5808 | 4356 | 10252 | 14652 | 0 | 8800 | 0 | 0 | 61380 | 1.830156 |
Mixoplankton Functional Type in LIS in Summer of 2017
| MFT | A | B | C | D | E | F | H | I | J | K | Totals | Percentages | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 0 | CM | 1962400 | 3212704 | 1264252 | 956252 | 1088252 | 516956 | 651904 | 835966 | 285956 | 286660 | 11061302 | 99.925273 |
| 1 | pSNCM | 1452 | 704 | 2156 | 1452 | 0 | 0 | 0 | 1452 | 1056 | 0 | 8272 | 0.074727 |
Mixoplankton Functional Type in LIS in Summer of 2018
| MFT | A | B | C | D | E | F | H | I | J | K | Totals | Percentages | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 0 | CM | 1148752 | 2011108 | 1259104 | 696652 | 1004652 | 381304 | 112156 | 153956 | 204160 | 145904 | 7117748 | 99.709686 |
| 1 | pSNCM | 704 | 3608 | 1408 | 352 | 1452 | 13200 | 0 | 0 | 0 | 0 | 20724 | 0.290314 |
Mixoplankton Functional Type in LIS in Summer of 2019
| MFT | A | B | C | D | E | F | H | I | J | K | Totals | Percentages | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 0 | CM | 1009052 | 827112 | 1074260 | 652652 | 476652 | 500104 | 462176 | 381304 | 283140 | 151228 | 5817680 | 98.908580 |
| 1 | eSNCM | 0 | 0 | 0 | 0 | 0 | 0 | 30800 | 792 | 6028 | 176 | 37796 | 0.642584 |
| 2 | pSNCM | 3784 | 13200 | 1584 | 0 | 1452 | 5852 | 176 | 352 | 0 | 0 | 26400 | 0.448836 |
Mixoplankton Functional Type in LIS in Summer of 2020
| MFT | A | B | C | D | E | F | H | I | J | K | Totals | Percentages | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 0 | CM | 1487200 | 1478444 | 1166704 | 912252 | 1776280 | 1682252 | 1255452 | 1307020 | 217140 | 164956 | 11447700 | 99.930480 |
| 1 | eSNCM | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1452 | 1452 | 0.012675 |
| 2 | pSNCM | 0 | 88 | 2904 | 2904 | 88 | 0 | 176 | 176 | 88 | 88 | 6512 | 0.056845 |
Mixoplankton Functional Type in LIS in Summer of 2021
| MFT | A | B | C | D | E | F | H | I | J | K | Totals | Percentages | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 0 | CM | 1582812 | 1705704 | 1150204 | 818400 | 611908 | 792000 | 240504 | 363704 | 780208 | 37004 | 8082448 | 99.90917 |
| 1 | pSNCM | 704 | 2156 | 2904 | 1056 | 0 | 352 | 0 | 0 | 88 | 88 | 7348 | 0.09083 |
In [15]:
display_tables_by_season('Fall')
Mixoplankton Functional Type in LIS in Fall of 2014
| MFT | A | B | C | D | E | F | H | I | J | K | Totals | Percentages | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 0 | CM | 580800 | 780252 | 503052 | 181852 | 219956 | 522060 | 601304 | 372504 | 95304 | 41008 | 3898092 | 99.962765 |
| 1 | pSNCM | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1452 | 0 | 0 | 1452 | 0.037235 |
Mixoplankton Functional Type in LIS in Fall of 2015
| MFT | A | B | C | D | E | F | H | I | J | K | Totals | Percentages | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 0 | CM | 514800 | 498652 | 616000 | 435600 | 130504 | 151052 | 61600 | 154880 | 37532 | 11704 | 2612324 | 100.0 |
Mixoplankton Functional Type in LIS in Fall of 2016
| MFT | A | B | C | D | E | F | H | I | J | K | Totals | Percentages | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 0 | CM | 72556 | 71852 | 23408 | 114312 | 39556 | 136400 | 30756 | 123156 | 32252 | 39556 | 683804 | 99.788108 |
| 1 | pSNCM | 0 | 1452 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1452 | 0.211892 |
Mixoplankton Functional Type in LIS in Fall of 2017
| MFT | A | B | C | D | E | F | H | I | J | K | Totals | Percentages | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 0 | CM | 417956 | 435556 | 328504 | 221452 | 216260 | 100408 | 212652 | 102608 | 199408 | 53416 | 2288220 | 99.875168 |
| 1 | pSNCM | 0 | 0 | 0 | 0 | 1452 | 0 | 0 | 704 | 0 | 0 | 2156 | 0.094104 |
| 2 | pSNCM* | 0 | 0 | 0 | 0 | 704 | 0 | 0 | 0 | 0 | 0 | 704 | 0.030728 |
Mixoplankton Functional Type in LIS in Fall of 2018
| MFT | A | B | C | D | E | F | H | I | J | K | Totals | Percentages | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 0 | CM | 459008 | 99660 | 250756 | 145860 | 269848 | 107228 | 71808 | 35156 | 3784 | 4356 | 1447464 | 99.975688 |
| 1 | pSNCM | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 352 | 0 | 352 | 0.024312 |
Mixoplankton Functional Type in LIS in Fall of 2019
| MFT | A | B | C | D | E | F | H | I | J | K | Totals | Percentages | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 0 | CM | 215600 | 285912 | 591008 | 277508 | 195756 | 205568 | 305228 | 96712 | 90112 | 4708 | 2268112 | 99.961216 |
| 1 | pSNCM | 0 | 0 | 176 | 176 | 0 | 352 | 176 | 0 | 0 | 0 | 880 | 0.038784 |
Mixoplankton Functional Type in LIS in Fall of 2020
| MFT | A | B | C | D | E | F | H | I | J | K | Totals | Percentages | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 0 | CM | 199628 | 71852 | 145200 | 4400 | 89452 | 58696 | 52800 | 57904 | 66396 | 1540 | 747868 | 99.994117 |
| 1 | pSNCM | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 44 | 44 | 0.005883 |
Mixoplankton Functional Type in LIS in Fall of 2021
| MFT | A | B | C | D | E | F | H | I | J | K | Totals | Percentages | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 0 | CM | 129756 | 199496 | 138512 | 24860 | 30756 | 38016 | 134948 | 110704 | 17908 | 5940 | 830896 | 100.0 |
In [16]:
# creates basemap for mixoplankton given dataframe df, tickmark boundary, and title
def make_basemap(df, boundary, title, scattercolumn='Totals'):
vmin, vmax = boundary
coord = pd.read_csv('LIS_CELLCOUNTS_2019 + Station Coords.csv')
coord = coord.fillna(0)
coords = coord[['ST', 'lat', 'lon']].drop_duplicates()
coords = pd.concat([df, coords], axis=1).drop(['ST'], axis=1)
x, y = (coords['lon'].tolist(), coords['lat'].tolist())
# Create Basemap and color bar
fig, ax = plt.subplots(figsize=(10, 10))
# Create a Basemap instance
map = Basemap(projection='cyl', lon_0=-73, lat_0=41, llcrnrlat=40.7, urcrnrlat=41.3, llcrnrlon=-74, urcrnrlon=-72, resolution='f', ax=ax)
# Add map features
map.drawmapboundary()
map.fillcontinents()
map.drawcoastlines()
map.drawparallels(np.arange(40.7, 41.3, .15), labels=[1, 1, 1, 1])
map.drawmeridians(np.arange(-74, -72, .25), labels=[1, 1, 1, 1])
# Scatter plot on the Basemap
sc = map.scatter(x, y, c=coords[scattercolumn], s=100, cmap='rainbow', edgecolor='black', zorder=5, norm=mcolors.Normalize(vmin=vmin, vmax=vmax))
# Color Bar
cbar = plt.colorbar(sc, ax=ax, orientation="vertical", shrink=0.25, aspect=8, pad=0.1)
cbar.set_ticks(np.linspace(vmin, vmax, 11))
cbar.set_ticklabels([f'{int(tick):,}' for tick in np.linspace(vmin, vmax, 11)])
fig.suptitle(title, fontsize=20, y=0.64)
coords = coords.drop(['lat', 'lon'], axis=1).set_index('Station').transpose()
plt.show()
display(coords)
In [24]:
# creates a season map for mixoplankton based on elevation ("bottom" or "surface") and season
def make_season_map(elevation, season, csv_name):
if elevation == "bottom":
elevation_var = "B"
elif elevation == "surface":
elevation_var = "S"
else:
raise ValueError(f"Invalid elevation: {elevation}.")
months = season2month.get(season)
vmin, vmax = season2boundary.get(season)
classified = Classifier(csv_name)
df = classified.add_multiheader(classified.mixoplankton)
df = df.loc[:, df.columns.get_level_values(0).isin(months)]
df.columns = df.columns.get_level_values(1)
df = df.groupby(df.columns.str[:3], axis=1).sum()
df = pd.DataFrame(df.sum()).reset_index().rename(columns={0: 'Totals', 'index': 'Station'})
df = df[df['Station'].str[2] == elevation_var].reset_index(drop=True)
year = re.search(r'\b(\d{4})\b', csv_name).group(1) if re.search(r'\b(\d{4})\b', csv_name) else 'Year not found'
make_basemap(df, (vmin, vmax), f'{elevation.capitalize()} Mixoplankton {season} {year}')
In [ ]:
for csv_name in csvs:
# Get map for each season
for season in season2month.keys():
make_season_map('surface', season, csv_name)
make_season_map('bottom', season, csv_name)
In [25]:
def display_figures_by_season(season):
for csv_name in csvs:
make_season_map('surface', season, csv_name)
make_season_map('bottom', season, csv_name)
In [26]:
display_figures_by_season("Winter")
| Station | A4S | B3S | C1S | D3S | E1S | F2S | H4S | I2S | J2S | K2S |
|---|---|---|---|---|---|---|---|---|---|---|
| Totals | 1636800 | 595452 | 638000 | 580800 | 110836 | 36652 | 155452 | 124036 | 140756 | 51260 |
| Station | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN |
|---|---|---|---|---|---|---|---|---|---|---|
| Totals | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN |
| Station | A4S | B3S | C1S | D3S | E1S | F2S | H4S | I2S | J2S | K2S |
|---|---|---|---|---|---|---|---|---|---|---|
| Totals | 167200 | 44000 | 61600 | 184800 | 123200 | 162800 | 134904 | 211200 | 192104 | 29304 |
| Station | A4B | B3B | C1B | D3B | E1B | F2B | H4B | I2B | J2B | K2B |
|---|---|---|---|---|---|---|---|---|---|---|
| Totals | 242000 | 259600 | 146652 | 193600 | 220000 | 224400 | 220000 | 5808 | 51304 | 88000 |
| Station | A4S | B3S | C1S | D3S | E1S | F2S | H4S | I2S | J2S | K2S |
|---|---|---|---|---|---|---|---|---|---|---|
| Totals | 42504 | 105600 | 96800 | 2904 | 23452 | 41052 | 127600 | 88000 | 52800 | 17600 |
| Station | A4B | B3B | C1B | D3B | E1B | F2B | H4B | I2B | J2B | K2B |
|---|---|---|---|---|---|---|---|---|---|---|
| Totals | 35200 | 120252 | 118800 | 36652 | 1452 | 63052 | 73304 | 93852 | 0 | 8800 |
| Station | A4S | B3S | C1S | D3S | E1S | F2S | H4S | I2S | J2S | K2S |
|---|---|---|---|---|---|---|---|---|---|---|
| Totals | 114400 | 58652 | 27852 | 46904 | 32252 | 13200 | 2904 | 11704 | 16104 | 1452 |
| Station | A4B | B3B | C1B | D3B | E1B | F2B | H4B | I2B | J2B | K2B |
|---|---|---|---|---|---|---|---|---|---|---|
| Totals | 52756 | 20504 | 42504 | 76252 | 11704 | 26400 | 30800 | 17600 | 21956 | 0 |
| Station | A4S | B3S | C1S | D3S | E1S | F2S | H4S | I2S | J2S | K2S |
|---|---|---|---|---|---|---|---|---|---|---|
| Totals | 198704 | 232408 | 349052 | 206800 | 211904 | 64504 | 101904 | 101904 | 10252 | 44000 |
| Station | A4B | B3B | C1B | D3B | E1B | F2B | H4B | I2B | J2B | K2B |
|---|---|---|---|---|---|---|---|---|---|---|
| Totals | 289564 | 92400 | 194260 | 200816 | 110704 | 140756 | 248556 | 44704 | 5060 | 68860 |
| Station | A4S | B3S | C1S | D3S | E1S | F2S | H4S | I2S | J2S | K2S |
|---|---|---|---|---|---|---|---|---|---|---|
| Totals | 108856 | 117304 | 54604 | 49852 | 13904 | 154000 | 133452 | 124608 | 111452 | 66000 |
| Station | A4B | B3B | C1B | D3B | E1B | F2B | H4B | I2B | J2B | K2B |
|---|---|---|---|---|---|---|---|---|---|---|
| Totals | 89452 | 99704 | 48400 | 255200 | 280104 | 66000 | 76956 | 45408 | 11880 | 0 |
| Station | A4S | B3S | C1S | D3S | E1S | F2S | H4S | I2S | J2S | K2S |
|---|---|---|---|---|---|---|---|---|---|---|
| Totals | 154000 | 550176 | 445852 | 133452 | 118008 | 103004 | 160160 | 32428 | 127688 | 24156 |
| Station | A4B | B3B | C1B | D3B | E1B | F2B | H4B | I2B | J2B | K2B |
|---|---|---|---|---|---|---|---|---|---|---|
| Totals | 61600 | 133452 | 321200 | 215600 | 88000 | 39600 | 180400 | 28292 | 17600 | 39600 |
| Station | A4S | B3S | C1S | D3S | E1S | F2S | H4S | I2S | J2S | K2S |
|---|---|---|---|---|---|---|---|---|---|---|
| Totals | 57200 | 8800 | 118800 | 107052 | 14652 | 158400 | 105600 | 63052 | 9504 | 61644 |
| Station | A4B | B3B | C1B | D3B | E1B | F2B | H4B | I2B | J2B | K2B |
|---|---|---|---|---|---|---|---|---|---|---|
| Totals | 167200 | 118800 | 123200 | 105600 | 105600 | 20504 | 286000 | 137852 | 9504 | 107052 |
In [27]:
display_figures_by_season("Spring")
| Station | A4S | B3S | C1S | D3S | E1S | F2S | H4S | I2S | J2S | K2S |
|---|---|---|---|---|---|---|---|---|---|---|
| Totals | 1739136 | 1999008 | 1506252 | 2230756 | 1865600 | 853512 | 2069018 | 1047156 | 1033956 | 852060 |
| Station | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN |
|---|---|---|---|---|---|---|---|---|---|---|
| Totals | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN |
| Station | A4S | B3S | C1S | D3S | E1S | F2S | H4S | I2S | J2S | K2S |
|---|---|---|---|---|---|---|---|---|---|---|
| Totals | 423852 | 479600 | 466400 | 435600 | 343200 | 1029600 | 416504 | 303600 | 335852 | 321200 |
| Station | A4B | B3B | C1B | D3B | E1B | F2B | H4B | I2B | J2B | K2B |
|---|---|---|---|---|---|---|---|---|---|---|
| Totals | 872652 | 1377200 | 674080 | 397452 | 462000 | 888756 | 228800 | 265452 | 432652 | 154000 |
| Station | A4S | B3S | C1S | D3S | E1S | F2S | H4S | I2S | J2S | K2S |
|---|---|---|---|---|---|---|---|---|---|---|
| Totals | 457600 | 331452 | 139304 | 639452 | 41008 | 95304 | 61556 | 123200 | 46904 | 39600 |
| Station | A4B | B3B | C1B | D3B | E1B | F2B | H4B | I2B | J2B | K2B |
|---|---|---|---|---|---|---|---|---|---|---|
| Totals | 211200 | 274252 | 167200 | 243452 | 52800 | 136400 | 63052 | 152504 | 134904 | 45452 |
| Station | A4S | B3S | C1S | D3S | E1S | F2S | H4S | I2S | J2S | K2S |
|---|---|---|---|---|---|---|---|---|---|---|
| Totals | 624800 | 293304 | 200904 | 256652 | 140800 | 105600 | 120252 | 111452 | 360800 | 62260 |
| Station | A4B | B3B | C1B | D3B | E1B | F2B | H4B | I2B | J2B | K2B |
|---|---|---|---|---|---|---|---|---|---|---|
| Totals | 353452 | 247852 | 229548 | 441452 | 441452 | 199452 | 243452 | 33704 | 233200 | 57156 |
| Station | A4S | B3S | C1S | D3S | E1S | F2S | H4S | I2S | J2S | K2S |
|---|---|---|---|---|---|---|---|---|---|---|
| Totals | 365200 | 507408 | 662904 | 358556 | 444400 | 313104 | 277200 | 357104 | 215600 | 85052 |
| Station | A4B | B3B | C1B | D3B | E1B | F2B | H4B | I2B | J2B | K2B |
|---|---|---|---|---|---|---|---|---|---|---|
| Totals | 836000 | 611600 | 973852 | 198704 | 83600 | 326304 | 286000 | 418704 | 46904 | 97152 |
| Station | A4S | B3S | C1S | D3S | E1S | F2S | H4S | I2S | J2S | K2S |
|---|---|---|---|---|---|---|---|---|---|---|
| Totals | 228800 | 400400 | 270028 | 356400 | 209704 | 38456 | 211200 | 381304 | 189156 | 132000 |
| Station | A4B | B3B | C1B | D3B | E1B | F2B | H4B | I2B | J2B | K2B |
|---|---|---|---|---|---|---|---|---|---|---|
| Totals | 660000 | 290356 | 177452 | 325600 | 422400 | 340252 | 214104 | 308000 | 272800 | 57904 |
| Station | A4S | B3S | C1S | D3S | E1S | F2S | H4S | I2S | J2S | K2S |
|---|---|---|---|---|---|---|---|---|---|---|
| Totals | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
| Station | A4B | B3B | C1B | D3B | E1B | F2B | H4B | I2B | J2B | K2B |
|---|---|---|---|---|---|---|---|---|---|---|
| Totals | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
| Station | A4S | B3S | C1S | D3S | E1S | F2S | H4S | I2S | J2S | K2S |
|---|---|---|---|---|---|---|---|---|---|---|
| Totals | 655776 | 1020976 | 526856 | 369600 | 193952 | 171600 | 324808 | 102608 | 182908 | 70752 |
| Station | A4B | B3B | C1B | D3B | E1B | F2B | H4B | I2B | J2B | K2B |
|---|---|---|---|---|---|---|---|---|---|---|
| Totals | 180400 | 563200 | 202400 | 107052 | 303600 | 365200 | 393756 | 418000 | 192104 | 70400 |
In [29]:
display_figures_by_season("Summer")
| Station | A4S | B3S | C1S | D3S | E1S | F2S | H4S | I2S | J2S | K2S |
|---|---|---|---|---|---|---|---|---|---|---|
| Totals | 1170356 | 818400 | 508904 | 626252 | 349052 | 328460 | 360756 | 108504 | 243452 | 99616 |
| Station | A4B | B3B | C1B | D3B | E1B | F2B | H4B | I2B | J2B | K2B |
|---|---|---|---|---|---|---|---|---|---|---|
| Totals | 720104 | 243408 | 186208 | 146652 | 202400 | 124652 | 133452 | 177452 | 244904 | 200860 |
| Station | A4S | B3S | C1S | D3S | E1S | F2S | H4S | I2S | J2S | K2S |
|---|---|---|---|---|---|---|---|---|---|---|
| Totals | 426800 | 896104 | 885852 | 466400 | 388652 | 484000 | 112904 | 70400 | 66000 | 23408 |
| Station | A4B | B3B | C1B | D3B | E1B | F2B | H4B | I2B | J2B | K2B |
|---|---|---|---|---|---|---|---|---|---|---|
| Totals | 88000 | 259160 | 88880 | 353320 | 112640 | 118800 | 265888 | 213400 | 17600 | 22000 |
| Station | A4S | B3S | C1S | D3S | E1S | F2S | H4S | I2S | J2S | K2S |
|---|---|---|---|---|---|---|---|---|---|---|
| Totals | 167156 | 217008 | 470756 | 214060 | 41052 | 101200 | 167200 | 640904 | 0 | 60060 |
| Station | A4B | B3B | C1B | D3B | E1B | F2B | H4B | I2B | J2B | K2B |
|---|---|---|---|---|---|---|---|---|---|---|
| Totals | 484000 | 165704 | 243452 | 133452 | 76252 | 90904 | 22000 | 32252 | 0 | 26400 |
| Station | A4S | B3S | C1S | D3S | E1S | F2S | H4S | I2S | J2S | K2S |
|---|---|---|---|---|---|---|---|---|---|---|
| Totals | 1295052 | 2803504 | 1231208 | 630652 | 866800 | 141504 | 541200 | 545566 | 240504 | 272800 |
| Station | A4B | B3B | C1B | D3B | E1B | F2B | H4B | I2B | J2B | K2B |
|---|---|---|---|---|---|---|---|---|---|---|
| Totals | 668800 | 409904 | 35200 | 327052 | 221452 | 375452 | 110704 | 291852 | 46508 | 13860 |
| Station | A4S | B3S | C1S | D3S | E1S | F2S | H4S | I2S | J2S | K2S |
|---|---|---|---|---|---|---|---|---|---|---|
| Totals | 621456 | 1727264 | 1203312 | 541552 | 894652 | 330000 | 59356 | 139304 | 90904 | 115104 |
| Station | A4B | B3B | C1B | D3B | E1B | F2B | H4B | I2B | J2B | K2B |
|---|---|---|---|---|---|---|---|---|---|---|
| Totals | 528000 | 287452 | 57200 | 155452 | 111452 | 64504 | 52800 | 14652 | 113256 | 30800 |
| Station | A4S | B3S | C1S | D3S | E1S | F2S | H4S | I2S | J2S | K2S |
|---|---|---|---|---|---|---|---|---|---|---|
| Totals | 835384 | 696608 | 990792 | 366652 | 297704 | 466356 | 255376 | 313544 | 154176 | 118976 |
| Station | A4B | B3B | C1B | D3B | E1B | F2B | H4B | I2B | J2B | K2B |
|---|---|---|---|---|---|---|---|---|---|---|
| Totals | 177452 | 143704 | 85052 | 286000 | 180400 | 39600 | 237776 | 68904 | 134992 | 32428 |
| Station | A4S | B3S | C1S | D3S | E1S | F2S | H4S | I2S | J2S | K2S |
|---|---|---|---|---|---|---|---|---|---|---|
| Totals | 1443200 | 1249732 | 830808 | 579304 | 1663376 | 1299452 | 1029688 | 620576 | 110176 | 64504 |
| Station | A4B | B3B | C1B | D3B | E1B | F2B | H4B | I2B | J2B | K2B |
|---|---|---|---|---|---|---|---|---|---|---|
| Totals | 44000 | 228800 | 338800 | 335852 | 112992 | 382800 | 225940 | 686620 | 107052 | 101992 |
| Station | A4S | B3S | C1S | D3S | E1S | F2S | H4S | I2S | J2S | K2S |
|---|---|---|---|---|---|---|---|---|---|---|
| Totals | 1103960 | 1236708 | 975656 | 317856 | 79200 | 589996 | 215600 | 281600 | 758296 | 36740 |
| Station | A4B | B3B | C1B | D3B | E1B | F2B | H4B | I2B | J2B | K2B |
|---|---|---|---|---|---|---|---|---|---|---|
| Totals | 479556 | 471152 | 177452 | 501600 | 532708 | 202356 | 24904 | 82104 | 22000 | 352 |
In [30]:
display_figures_by_season("Fall")
| Station | A4S | B3S | C1S | D3S | E1S | F2S | H4S | I2S | J2S | K2S |
|---|---|---|---|---|---|---|---|---|---|---|
| Totals | 356400 | 357852 | 230252 | 63052 | 80652 | 265408 | 494252 | 237556 | 20504 | 7304 |
| Station | A4B | B3B | C1B | D3B | E1B | F2B | H4B | I2B | J2B | K2B |
|---|---|---|---|---|---|---|---|---|---|---|
| Totals | 224400 | 422400 | 272800 | 118800 | 139304 | 256652 | 107052 | 136400 | 74800 | 33704 |
| Station | A4S | B3S | C1S | D3S | E1S | F2S | H4S | I2S | J2S | K2S |
|---|---|---|---|---|---|---|---|---|---|---|
| Totals | 470800 | 463452 | 431200 | 316800 | 107052 | 52800 | 52800 | 119680 | 37532 | 10252 |
| Station | A4B | B3B | C1B | D1B | D3B | E1B | F2B | H4B | I2B | J2B | K2B |
|---|---|---|---|---|---|---|---|---|---|---|---|
| Totals | 44000 | 35200 | 184800 | 88000 | 30800 | 23452 | 98252 | 8800 | 35200 | 0 | 1452 |
| Station | A4S | B3S | C1S | D3S | E1S | F2S | H4S | I2S | J2S | K2S |
|---|---|---|---|---|---|---|---|---|---|---|
| Totals | 32252 | 45452 | 16104 | 71808 | 29304 | 35200 | 27852 | 114356 | 17600 | 2904 |
| Station | A4B | B3B | C1B | D3B | E1B | F2B | H4B | I2B | J2B | K2B |
|---|---|---|---|---|---|---|---|---|---|---|
| Totals | 40304 | 27852 | 7304 | 42504 | 10252 | 101200 | 2904 | 8800 | 14652 | 36652 |
| Station | A4S | B3S | C1S | D3S | E1S | F2S | H4S | I2S | J2S | K2S |
|---|---|---|---|---|---|---|---|---|---|---|
| Totals | 343156 | 275704 | 249304 | 79200 | 116512 | 27104 | 96800 | 71104 | 109956 | 24904 |
| Station | A4B | B3B | C1B | D3B | E1B | F2B | H4B | I2B | J2B | K2B |
|---|---|---|---|---|---|---|---|---|---|---|
| Totals | 74800 | 159852 | 79200 | 142252 | 101904 | 73304 | 115852 | 32208 | 89452 | 28512 |
| Station | A4S | B3S | C1S | D3S | E1S | F2S | FBS | H4S | I2S | J2S | K2S |
|---|---|---|---|---|---|---|---|---|---|---|---|
| Totals | 214104 | 82104 | 228756 | 34408 | 221452 | 54252 | 17776 | 68904 | 26356 | 3432 | 4356 |
| Station | A4B | B3B | C1B | D3B | E1B | F2B | H4B | I2B | J2B | K2B |
|---|---|---|---|---|---|---|---|---|---|---|
| Totals | 244904 | 17556 | 22000 | 111452 | 48396 | 35200 | 2904 | 8800 | 704 | 0 |
| Station | A4S | B3S | C1S | D3S | E1S | F2S | H4S | I2S | J2S | K2S |
|---|---|---|---|---|---|---|---|---|---|---|
| Totals | 165704 | 234608 | 434280 | 242176 | 146652 | 139832 | 186428 | 68904 | 20504 | 1628 |
| Station | A4B | B3B | C1B | D3B | E1B | F2B | H4B | I2B | J2B | K2B |
|---|---|---|---|---|---|---|---|---|---|---|
| Totals | 49896 | 51304 | 156904 | 35508 | 49104 | 66088 | 118976 | 27808 | 69608 | 3080 |
| Station | A4S | B3S | C1S | D3S | E1S | F2S | H4S | I2S | J2S | K2S |
|---|---|---|---|---|---|---|---|---|---|---|
| Totals | 111628 | 49852 | 114400 | 4400 | 66000 | 27852 | 22000 | 35552 | 66396 | 1452 |
| Station | A4B | B3B | C1B | D3B | E1B | F2B | H4B | I2B | J2B | K2B |
|---|---|---|---|---|---|---|---|---|---|---|
| Totals | 88000 | 22000 | 30800 | 0 | 23452 | 30844 | 30800 | 22352 | 0 | 132 |
| Station | A4S | B3S | C1S | D3S | E1S | F2S | H4S | I2S | J2S | K2S |
|---|---|---|---|---|---|---|---|---|---|---|
| Totals | 89452 | 58696 | 129360 | 11748 | 17556 | 29304 | 55748 | 97152 | 14652 | 88 |
| Station | A4B | B3B | C1B | D3B | E1B | F2B | H4B | I2B | J2B | K2B |
|---|---|---|---|---|---|---|---|---|---|---|
| Totals | 40304 | 140800 | 9152 | 13112 | 13200 | 8712 | 79200 | 13552 | 3256 | 5852 |
What is the percentage of mixoplankton at each station? (maps)¶
In [31]:
def seasonal_trophic_strategy_per_station(csv_name, season):
# Get months corresponding to season
months = season2month.get(season)
# Clean data
classified = Classifier(csv_name)
by_station_SB = classified.add_multiheader(classified.all_classified)
removed_columns = by_station_SB.loc[:, by_station_SB.columns.get_level_values(2).isin(['Status', 'Phylum', 'Genus', 'Species'])].copy()
removed_columns.columns = removed_columns.columns.get_level_values(2)
other_columns = by_station_SB.loc[:, ~by_station_SB.columns.get_level_values(2).isin(['Status', 'Phylum', 'Genus', 'Species', 'Totals'])]
other_columns = other_columns.loc[:, other_columns.columns.get_level_values(0).isin(months)]
other_columns.columns = other_columns.columns.get_level_values(1)
other_columns = other_columns.groupby(other_columns.columns.str[0], axis=1).sum()
by_station_SB = pd.concat([removed_columns, other_columns ], axis=1)
by_station_SB = by_station_SB.drop(['Phylum', 'Genus', 'Species'], axis=1).replace('Yes', 'Mixoplankton').groupby('Status').sum()
by_station_SB.index.name = None
by_station_SB = by_station_SB.transpose().reset_index().rename(columns={"index": "Station"})
by_station_SB['Totals'] = by_station_SB[['Mixoplankton', 'No']].sum(axis=1)
by_station_SB['Mixoplankton %'] = by_station_SB['Mixoplankton'].div(by_station_SB['Mixoplankton'].sum(), axis=0) * 100
by_station_SB = by_station_SB.drop(['Mixoplankton', 'No', 'Totals'], axis=1)
# Get year
year = re.search(r'\b(\d{4})\b', csv_name).group(1) if re.search(r'\b(\d{4})\b', csv_name) else 'Year not found'
make_basemap(by_station_SB, (0, 100), f'Percentage of Mixoplankton by Station {season} {year}', scattercolumn='Mixoplankton %')
plt.show()
In [32]:
for csv_name in csvs:
# Get map for each season
for season in season2month.keys():
seasonal_trophic_strategy_per_station(csv_name, season)
| Station | A | B | C | D | E | F | H | I | J | K |
|---|---|---|---|---|---|---|---|---|---|---|
| Mixoplankton % | 40.215781 | 14.630112 | 15.675506 | 14.270116 | 2.723214 | 0.900531 | 3.819418 | 3.047535 | 3.458341 | 1.259446 |
| Station | A | B | C | D | E | F | H | I | J | K |
|---|---|---|---|---|---|---|---|---|---|---|
| Mixoplankton % | 11.444354 | 13.154437 | 9.911865 | 14.679451 | 12.276548 | 5.616521 | 13.615137 | 6.890792 | 6.803929 | 5.606966 |
| Station | A | B | C | D | E | F | H | I | J | K |
|---|---|---|---|---|---|---|---|---|---|---|
| Mixoplankton % | 27.030343 | 15.182037 | 9.938912 | 11.051204 | 7.88482 | 6.478726 | 7.066329 | 4.088681 | 6.982655 | 4.296293 |
| Station | A | B | C | D | E | F | H | I | J | K |
|---|---|---|---|---|---|---|---|---|---|---|
| Mixoplankton % | 14.894049 | 20.008801 | 12.900278 | 4.663417 | 5.640557 | 13.387719 | 15.419854 | 9.589737 | 2.443978 | 1.05161 |
| Station | A | B | C | D | E | F | H | I | J | K |
|---|---|---|---|---|---|---|---|---|---|---|
| Mixoplankton % | 13.81277 | 10.248184 | 7.02966 | 12.773099 | 11.584904 | 13.070148 | 11.979979 | 7.325224 | 8.21637 | 3.959661 |
| Station | A | B | C | D | E | F | H | I | J | K |
|---|---|---|---|---|---|---|---|---|---|---|
| Mixoplankton % | 12.577097 | 18.012404 | 11.063543 | 8.081252 | 7.811066 | 18.609545 | 6.259951 | 5.520247 | 7.455086 | 4.60981 |
| Station | A | B | C | D | E | F | H | I | J | K |
|---|---|---|---|---|---|---|---|---|---|---|
| Mixoplankton % | 9.604105 | 21.552596 | 18.184593 | 15.29269 | 9.3521 | 11.245832 | 7.066741 | 5.294571 | 1.559641 | 0.847131 |
| Station | A | B | C | D | E | F | H | I | J | K |
|---|---|---|---|---|---|---|---|---|---|---|
| Mixoplankton % | 19.706591 | 19.088444 | 23.580536 | 16.674808 | 4.995705 | 5.782284 | 2.358054 | 5.92882 | 1.436728 | 0.44803 |
| Station | A | B | C | D | E | F | H | I | J | K |
|---|---|---|---|---|---|---|---|---|---|---|
| Mixoplankton % | 6.758774 | 19.644839 | 18.75311 | 3.440622 | 2.166176 | 9.055073 | 17.474836 | 15.817674 | 4.592598 | 2.296299 |
| Station | A | B | C | D | E | F | H | I | J | K |
|---|---|---|---|---|---|---|---|---|---|---|
| Mixoplankton % | 19.348515 | 17.523135 | 8.867221 | 25.542586 | 2.713884 | 6.703242 | 3.604934 | 7.976171 | 5.259741 | 2.460571 |
| Station | A | B | C | D | E | F | H | I | J | K |
|---|---|---|---|---|---|---|---|---|---|---|
| Mixoplankton % | 19.4154 | 11.411254 | 21.29541 | 10.361702 | 3.497632 | 5.72793 | 5.641342 | 20.07137 | 0.0 | 2.577962 |
| Station | A | B | C | D | E | F | H | I | J | K |
|---|---|---|---|---|---|---|---|---|---|---|
| Mixoplankton % | 10.58816 | 10.697316 | 3.41595 | 16.681649 | 5.772441 | 19.90497 | 4.48825 | 17.972261 | 4.706562 | 5.772441 |
| Station | A | B | C | D | E | F | H | I | J | K |
|---|---|---|---|---|---|---|---|---|---|---|
| Mixoplankton % | 26.706503 | 12.646749 | 11.240773 | 19.676626 | 7.022847 | 6.326889 | 5.384886 | 4.681898 | 6.080844 | 0.231986 |
| Station | A | B | C | D | E | F | H | I | J | K |
|---|---|---|---|---|---|---|---|---|---|---|
| Mixoplankton % | 20.562122 | 11.374692 | 9.047778 | 14.673622 | 12.2385 | 6.411964 | 7.644785 | 3.05107 | 12.485434 | 2.510035 |
| Station | A | B | C | D | E | F | H | I | J | K |
|---|---|---|---|---|---|---|---|---|---|---|
| Mixoplankton % | 17.74099 | 29.029193 | 11.44044 | 8.651679 | 9.83102 | 4.670062 | 5.889152 | 7.565043 | 2.592801 | 2.589621 |
| Station | A | B | C | D | E | F | H | I | J | K |
|---|---|---|---|---|---|---|---|---|---|---|
| Mixoplankton % | 18.24275 | 19.010947 | 14.338391 | 9.665834 | 9.533321 | 4.382562 | 9.281736 | 4.509314 | 8.703668 | 2.331477 |
| Station | A | B | C | D | E | F | H | I | J | K |
|---|---|---|---|---|---|---|---|---|---|---|
| Mixoplankton % | 16.738061 | 11.134574 | 18.624996 | 13.973272 | 11.059157 | 7.036411 | 12.013937 | 5.025793 | 0.524903 | 3.868895 |
| Station | A | B | C | D | E | F | H | I | J | K |
|---|---|---|---|---|---|---|---|---|---|---|
| Mixoplankton % | 16.090342 | 14.989362 | 21.924711 | 7.464622 | 7.072678 | 8.565013 | 7.54419 | 10.392121 | 3.5163 | 2.440663 |
| Station | A | B | C | D | E | F | H | I | J | K |
|---|---|---|---|---|---|---|---|---|---|---|
| Mixoplankton % | 16.10227 | 28.223351 | 17.658009 | 9.76405 | 14.094109 | 5.526449 | 1.571149 | 2.156708 | 2.859996 | 2.043911 |
| Station | A | B | C | D | E | F | H | I | J | K |
|---|---|---|---|---|---|---|---|---|---|---|
| Mixoplankton % | 31.703476 | 6.883471 | 17.319604 | 10.074485 | 18.63828 | 7.40619 | 4.959746 | 2.428209 | 0.285672 | 0.300867 |
| Station | A | B | C | D | E | F | H | I | J | K |
|---|---|---|---|---|---|---|---|---|---|---|
| Mixoplankton % | 10.39821 | 11.378738 | 5.400978 | 15.995293 | 15.416205 | 11.535622 | 11.032669 | 8.914729 | 6.46687 | 3.460687 |
| Station | A | B | C | D | E | F | H | I | J | K |
|---|---|---|---|---|---|---|---|---|---|---|
| Mixoplankton % | 16.200306 | 12.590525 | 8.156293 | 12.430928 | 11.521465 | 6.902774 | 7.752087 | 12.564059 | 8.420149 | 3.461412 |
| Station | A | B | C | D | E | F | H | I | J | K |
|---|---|---|---|---|---|---|---|---|---|---|
| Mixoplankton % | 17.219608 | 14.286462 | 18.290831 | 11.095984 | 8.128427 | 8.601949 | 8.384264 | 6.502143 | 4.916255 | 2.574077 |
| Station | A | B | C | D | E | F | H | I | J | K |
|---|---|---|---|---|---|---|---|---|---|---|
| Mixoplankton % | 9.502017 | 12.600838 | 26.054918 | 12.23821 | 8.627443 | 9.075396 | 13.459898 | 4.262333 | 3.971455 | 0.207493 |
| Station | A | B | C | D | E | F | H | I | J | K |
|---|---|---|---|---|---|---|---|---|---|---|
| Mixoplankton % | 7.248842 | 22.984748 | 25.789606 | 11.735728 | 6.926343 | 4.794591 | 11.450212 | 2.041511 | 4.884832 | 2.143586 |
| Station | A | B | C | D | E | F | H | I | J | K |
|---|---|---|---|---|---|---|---|---|---|---|
| Mixoplankton % | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN |
| Station | A | B | C | D | E | F | H | I | J | K |
|---|---|---|---|---|---|---|---|---|---|---|
| Mixoplankton % | 12.982224 | 12.906559 | 10.209866 | 7.988677 | 15.50646 | 14.684893 | 10.960761 | 11.410914 | 1.89625 | 1.453395 |
| Station | A | B | C | D | E | F | H | I | J | K |
|---|---|---|---|---|---|---|---|---|---|---|
| Mixoplankton % | 26.691375 | 9.607013 | 19.414049 | 0.588305 | 11.960231 | 7.847982 | 7.059654 | 7.742087 | 8.877515 | 0.21179 |
| Station | A | B | C | D | E | F | H | I | J | K |
|---|---|---|---|---|---|---|---|---|---|---|
| Mixoplankton % | 11.898096 | 6.765584 | 12.83128 | 11.275196 | 6.37598 | 9.485816 | 20.763345 | 10.652296 | 1.007839 | 8.944569 |
| Station | A | B | C | D | E | F | H | I | J | K |
|---|---|---|---|---|---|---|---|---|---|---|
| Mixoplankton % | 13.032774 | 24.691223 | 11.366302 | 7.429175 | 7.754926 | 8.366651 | 11.199654 | 8.11428 | 5.844997 | 2.200018 |
| Station | A | B | C | D | E | F | H | I | J | K |
|---|---|---|---|---|---|---|---|---|---|---|
| Mixoplankton % | 19.574239 | 21.111286 | 14.253858 | 10.129501 | 7.563948 | 9.794462 | 2.97293 | 4.495836 | 9.645435 | 0.458504 |
| Station | A | B | C | D | E | F | H | I | J | K |
|---|---|---|---|---|---|---|---|---|---|---|
| Mixoplankton % | 15.616395 | 24.009744 | 16.670197 | 2.991951 | 3.701546 | 4.575302 | 16.241262 | 13.323448 | 2.155264 | 0.714891 |
How do the number of mixoplankton from west to east change every year?¶
In [33]:
def mixoplankton_per_station(csv_name):
# Remove Classification columns and groupby Station for entire year
classified = Classifier(csv_name)
by_station = classified.mixoplankton_with_header
species_columns = by_station.columns.get_level_values(2).isin(['Phylum', 'Genus', 'Species', 'MFT', 'Evidence of mixoplankton activity', 'size class', 'Totals'])
by_station = by_station.loc[:, ~species_columns]
by_station.columns = by_station.columns.get_level_values(1)
by_station = by_station.groupby(by_station.columns.str[0], axis=1).sum()
totals_station = by_station.sum()
totals_station = pd.DataFrame(totals_station).reset_index().rename(columns={0: 'Totals', 'index': 'Station'})
# Get year
year = re.search(r'\b(\d{4})\b', csv_name).group(1) if re.search(r'\b(\d{4})\b', csv_name) else 'Year not found'
# Make basemap
make_basemap(totals_station, (0, 6000000), f'Mixoplankton {year}')
In [34]:
for csv_name in csvs:
# Get map for each year
mixoplankton_per_station(csv_name)
| Station | A | B | C | D | E | F | H | I | J | K |
|---|---|---|---|---|---|---|---|---|---|---|
| Totals | 5847196 | 4436520 | 3342416 | 3766312 | 2747844 | 1865336 | 3319982 | 1831104 | 1758372 | 1244804 |
| Station | A | B | C | D | E | F | H | I | J | K |
|---|---|---|---|---|---|---|---|---|---|---|
| Totals | 2735304 | 3814316 | 2939464 | 2466772 | 1780196 | 3059408 | 1440600 | 1224740 | 1133044 | 649616 |
| Station | A | B | C | D | E | F | H | I | J | K |
|---|---|---|---|---|---|---|---|---|---|---|
| Totals | 1470216 | 1287572 | 1259720 | 1384284 | 275572 | 664312 | 545468 | 1253868 | 266860 | 237468 |
| Station | A | B | C | D | E | F | H | I | J | K |
|---|---|---|---|---|---|---|---|---|---|---|
| Totals | 3527216 | 4269276 | 2095720 | 2000416 | 1932876 | 962016 | 1261964 | 1115190 | 1118480 | 460944 |
| Station | A | B | C | D | E | F | H | I | J | K |
|---|---|---|---|---|---|---|---|---|---|---|
| Totals | 3297932 | 3558192 | 3691336 | 1807740 | 2126560 | 1346400 | 1097624 | 1111528 | 486112 | 445324 |
| Station | A | B | C | D | E | F | H | I | J | K |
|---|---|---|---|---|---|---|---|---|---|---|
| Totals | 2315544 | 2033988 | 2217512 | 1917388 | 1599972 | 1310584 | 1434268 | 1338480 | 964568 | 412016 |
| Station | A | B | C | D | E | F | H | I | J | K |
|---|---|---|---|---|---|---|---|---|---|---|
| Totals | 1902428 | 2234012 | 2081860 | 1268608 | 2071828 | 1883552 | 1648988 | 1425820 | 428912 | 231836 |
| Station | A | B | C | D | E | F | H | I | J | K |
|---|---|---|---|---|---|---|---|---|---|---|
| Totals | 2773848 | 3619132 | 2262876 | 1533620 | 1260468 | 1546072 | 1485616 | 1195920 | 1192224 | 352880 |
Depth profile for oxygen concentration in sea water at each station in Summer of 2021¶
In [19]:
def oxy_depth_narrows():
# Clean Data
oxy = pd.read_csv("DEEP_WQ_oxygen_ALL.csv", dtype={'Station': 'str'})
oxy = oxy[['Station', 'Date', 'depth', 'oxygen_concentration_in_sea_water mg/L']]
oxy['Date'] = pd.to_datetime(oxy['Date'])
oxy = oxy[(oxy['Date'] >= '2021-06-20') & (oxy['Date'] <= '2021-09-22')]
for Station in ['A4', 'B3', '1', '2', 'C1', '3', '4', '5', 'C2', '6', '7', 'D3']:
oxy_station = oxy[oxy['Station'] == Station]
plt.scatter(oxy_station['oxygen_concentration_in_sea_water mg/L'], oxy_station['depth'])
plt.gca().invert_yaxis()
plt.xlabel('Oxygen Concentration in Sea Water mg/L')
plt.ylabel('Depth')
plt.xticks(np.arange(0, 13, 1))
plt.yticks(np.arange(0, 46, 5))
plt.title(f'Station {Station} LIS Narrows Summer 2021')
plt.show()
In [20]:
# Get plot for each station
oxy_depth_narrows()
In [21]:
def oxy_depth(year, season):
# Clean Data
oxy = pd.read_csv("DEEP_WQ_oxygen_more.csv", dtype={'Station': 'str'})
oxy =oxy.copy()
oxy = oxy[['Station', 'Date', 'depth (m)', 'oxygen_concentration_in_sea_water (mg/L)']]
oxy['Date'] = pd.to_datetime(oxy['Date'])
oxy = oxy[(oxy['Date'] >= season2timestamp[season][0]) & (oxy['Date'] <= season2timestamp[season][1])]
oxy = oxy[oxy['Station'].isin(['A4', 'B3', 'C1', 'D3', 'E1', 'F2', 'H4', 'I2', 'J2', 'K2'])]
for Station in ['A4', 'B3', 'C1', 'D3', 'E1', 'F2', 'H4', 'I2', 'J2', 'K2']:
oxy_station = oxy[oxy['Station'] == Station]
plt.scatter(oxy_station['oxygen_concentration_in_sea_water (mg/L)'], oxy_station['depth (m)'])
plt.gca().invert_yaxis()
plt.xlabel('Oxygen Concentration in Sea Water mg/L')
plt.ylabel('Depth')
plt.xticks(np.arange(0, 21, 1))
plt.yticks(np.arange(0, 46, 5))
plt.title(f'Station {Station} LIS {season} {year}')
plt.show()
In [22]:
for year in [2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021]:
season2timestamp = {'Winter': (f'{year-1}-12-21', f'{year}-03-20'), 'Spring': (f'{year}-03-21', f'{year}-06-20'), 'Summer': (f'{year}-06-21', f'{year}-09-21'), 'Fall': (f'{year}-09-22', f'{year}-12-20')}
# Get map for each season
for season in season2timestamp.keys():
oxy_depth(year, season)
In [ ]:
# oxy = pd.read_csv("DEEP_WQ_oxygen_ALL.csv", dtype={'Station': 'str'})
# oxy = oxy[['Station', 'latitude N', 'longitude E']]
# oxy = oxy[oxy['Station'].isin(['1', '2', '3', '4', '5', '6', '7', 'A4', 'B3', 'C1', 'C2', 'D3'])].drop_duplicates().reset_index(drop=True)
# # Create Basemap and color bar
# fig, ax = plt.subplots(figsize=(10, 10))
# # Create a Basemap instance
# map = Basemap(projection='cyl', lon_0=-73, lat_0=41, llcrnrlat=40.7, urcrnrlat=41.3, llcrnrlon=-74, urcrnrlon=-72, resolution='f', ax=ax)
# # Add map features
# map.drawmapboundary()
# map.fillcontinents()
# map.drawcoastlines()
# map.drawparallels(np.arange(40.7, 41.3, .15), labels=[1, 1, 1, 1])
# map.drawmeridians(np.arange(-74, -72, .25), labels=[1, 1, 1, 1])
# for i in range(len(oxy)):
# plt.annotate(oxy['Station'][i], (oxy['longitude E'][i], oxy['latitude N'][i]), color='black')
# # Scatter plot on the Basemap
# map.scatter(oxy['longitude E'], oxy['latitude N'], s=100, zorder=2, color='lime')
# plt.show